package com.jiangruan.javainspect.service;

import com.alibaba.fastjson.JSONObject;
import com.jiangruan.javainspect.Constants;
import com.jiangruan.javainspect.bean.HotVideo;
import com.jiangruan.javainspect.bean.HotVideoCommon;
import com.jiangruan.javainspect.request.HttpUtils;

import java.util.List;

/**
 * @author:liyaqi
 * @email:3441520483@qq.com
 * @desc:
 * @datatime: 2021/12/9 21:46
 */
public class HotVideoService {
    /**
     * 该方法用于获取热门数据，并将热门数据返回
     *
     * @return
     */
    public HotVideoCommon getHotVideo() {
        System.out.println("hello world");
        String url = Constants.TRIP_URL
                + "?key=" + Constants.TRIP_key
                + "&type=hot_video"
                + "&size=20";
        String result = HttpUtils.get(url);
        System.out.println(result);

        //json解析
        HotVideoCommon videoCommon = JSONObject.parseObject(result, HotVideoCommon.class);

        return videoCommon;
    }
}